package day240606.eunm;

import day240606.eunm.Day;

public class DayTest {
    public static void main(String[] args) {
        whatcanisay();
        System.out.println("==== ==== ====");
        useWithSwitch(Day.FRIDAY);

    }private static void whatcanisay(){
        //虽然目前只有两行代码,但是背后应该要能联想器很多知识。

        //对象本质都是 new 出来的
        //以前遇到了一些表面上不是new 出来,但是一直看到它底层,也是 new。
        // - Integer.valueOf() ... 做了优化
        // - "abc"
        // -.. 。这些都是在做优化

        //直接 sout 打印,看输出
        // -如果是 xxx@xxx 来自 Object toString 方法,没特殊出来
        // -如果不是这种默认格式,就可以主动点进去研究一下
        //-要看 toString 方法的源码,可以主动.toString()
        Day monday = Day.MONDAY;
        System.out.println(monday);
        //通过阅读toString源码，大概能猜出继承Enum类
        System.out.println(monday.toString());
        //再次强调探索未知的类/对象,几个重要思路`
        System.out.println(monday.name());
        System.out.println(monday.ordinal());
        System.out.println(Day.SUNDAY.ordinal());
        System.out.println(Day.TUESDAY.ordinal());

        System.out.println("=== === ===");
        Day[] values = Day.values();
        for (Day day : values) {
            System.out.println(day);
        }
        System.out.println(monday.name()+"-"+monday.ordinal());
        System.out.println("==== ==== ====");
        System.out.println(Day.valueOf("FRIDAY"));
        System.out.println("==== ==== ====");

    }
    private static void useWithSwitch(Day day) {
        switch (day) {
            case MONDAY:
                System.out.println("一脸懵");
                break;
            case TUESDAY:
                System.out.println("前不着村，后不着店");
                break;
            case WEDNESDAY:
                System.out.println("Midweek days are so-so.");
                break;
            case THURSDAY:
                System.out.println("加把劲");
                break;
            case FRIDAY:
                System.out.println("心已放假");
                break;
            case SATURDAY:
                System.out.println("爽啊");
                break;
            case SUNDAY:
                System.out.println("握草，这就...");
                break;
        }
    }
}
